import myAxios from "@/request/myAxios.ts";

// 登录
export const login = (userAccount:string,userPassword:string) => {
    return  myAxios.post('/user/login', {
        userAccount,
        userPassword
    })
}

// 注册
export const register = (phone:string,code:string,userAccount:string,userPassword:string,checkPassword:string) => {
    return myAxios.post('/user/register',{
        phone,
        code,
        userAccount,
        userPassword,
        checkPassword
    })
}
// 注册发送验证码
export const sendCode = (phone:string) => {
    return myAxios.get('/user/message',{
        params:{
            phone
        }
    })
}

// 忘记密码发送验证码
export const sendCodeForget = (phone:string) => {
    return myAxios.get('/user/forget',{
        params:{
            phone
        }
    })
}
// 忘记密码校验验证码
export const checkCode = (phone:string,code:string) => {
    return myAxios.get('/user/check',{
        params:{
            phone,
            code
        }
    })
}
// 提交新密码
export const submitPassword = (code:string,confirmPassword:string,password:string,phone:string) => {
    return myAxios.put('/user/forget',{
        code,
        confirmPassword,
        password,
        phone
    })
}

// 退出登录
export const logout = () => {
    return myAxios.post('/user/logout')
}